package com.ost.kautilya.modeling.weka;

import com.ost.kautilya.modeling.EvaluationMetric;
import com.ost.kautilya.modeling.ModelEvaluation;

import weka.classifiers.Evaluation;

public class WekaClassifierEvaluation extends ModelEvaluation {
	private static final long serialVersionUID = 1L;

	public WekaClassifierEvaluation(Evaluation ev, int classSize, byte[] output)
			throws Exception {
		super(classSize, output);
		try {
			setMatrix(ev.confusionMatrix());
		} catch (Exception e) {

		}
		setMetric(0, EvaluationMetric.NUMBER_OF_INSTANCES, ev.numInstances());
		setMetric(0, EvaluationMetric.CORRECT, ev.correct());
		setMetric(0, EvaluationMetric.INCORRECT, ev.incorrect());
		setMetric(0,
				EvaluationMetric.COVERAGE_OF_TEST_CASES_BY_PREDICTED_REGION,
				ev.coverageOfTestCasesByPredictedRegions());
		try {
			setMetric(0, EvaluationMetric.WEIGHTED_PRECISION,
					ev.weightedPrecision());
		} catch (Exception e) {

		}

		setMetric(0, EvaluationMetric.UNCLASSIFIED, ev.unclassified());
		setMetric(0, EvaluationMetric.TOTAL_COST, ev.totalCost());
		setMetric(0, EvaluationMetric.AVERAGE_COST, ev.avgCost());
		setMetric(0, EvaluationMetric.PCT_CORRECT, ev.pctCorrect());
		setMetric(0, EvaluationMetric.PCT_INCORRECT, ev.pctIncorrect());
		setMetric(0, EvaluationMetric.PCT_UNCLASSIFIED, ev.pctUnclassified());

		try {
			setMetric(0, EvaluationMetric.CORRELATION_COEFFICIENT,
					ev.correlationCoefficient());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.ERROR_RATE, ev.errorRate());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.KAPPA_MEAN, ev.kappa());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.KB_INFORMATION, ev.KBInformation());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.KB_MEAN_INFORMATION,
					ev.KBMeanInformation());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.KB_RELATIVE_INFORMATION,
					ev.KBRelativeInformation());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.MEAN_ABSOLUTE_ERROR,
					ev.meanAbsoluteError());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.MEAN_PRIOR_ABSOLUTE_ERROR,
					ev.meanPriorAbsoluteError());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.PRIOR_ENTROPY, ev.priorEntropy());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.RELATIVE_ABSOLUTE_ERROR,
					ev.relativeAbsoluteError());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.ROOT_MEAN_SQUARED_ERROR,
					ev.rootMeanSquaredError());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.ROOT_MEAN_PRIOR_SQUARRED_ERROR,
					ev.rootMeanPriorSquaredError());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.ROOT_RELATIVE_SQUARRED_ERROR,
					ev.rootRelativeSquaredError());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.SF_ENTROPY_GAIN, ev.SFEntropyGain());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.SF_MEAN_ENTROPY_GAIN,
					ev.SFMeanEntropyGain());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.SF_MEAN_PRIOR_ENTROPY,
					ev.SFMeanPriorEntropy());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.SF_MEAN_SCHEME_ENTROPY,
					ev.SFMeanSchemeEntropy());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.SF_PRIOR_ENTROPY, ev.SFPriorEntropy());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.SF_SCHEME_ENTROPY,
					ev.SFSchemeEntropy());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.UNWEIGHTED_MACRO_F_MEASURE,
					ev.unweightedMacroFmeasure());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.UNWEIGHTED_MICRO_F_MEASURE,
					ev.unweightedMicroFmeasure());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.WEIGHTED_FALSE_NEGATIVE_RATE,
					ev.weightedFalseNegativeRate());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.WEIGHTED_FALSE_POSITIVE_RATE,
					ev.weightedFalsePositiveRate());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.WEIGHTED_F_MEASURE,
					ev.weightedFMeasure());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.WEIGHTED_MATTHEWS_CORRELATION,
					ev.weightedMatthewsCorrelation());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.WEIGHTED_RECALL, ev.weightedRecall());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.WEIGHTED_TRUE_NEGATIVE_RATE,
					ev.weightedTrueNegativeRate());
		} catch (Exception e) {

		}
		try {
			setMetric(0, EvaluationMetric.WEIGHTED_TRUE_POSITIVE_RATE,
					ev.weightedTruePositiveRate());
		} catch (Exception e) {

		}
		try {
		} catch (Exception e) {

		}
	}
}
